package com.spring.controller.service.user;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * Created by chenhs on 2018/6/19.
 */
public class Main {

    @Test
    public void testClassPathXmlApplicationContext() {
        ApplicationContext context = new ClassPathXmlApplicationContext("common-beans.xml");
        UserService userService = context.getBean("studentUserService", StudentServiceImpl.class);
        userService.hello();
    }

    @Test
    public void testFileSystemXmlApplicationContext() {
        ApplicationContext context = new FileSystemXmlApplicationContext("D:\\idea-workspace\\springMvc\\src\\main\\resources\\common-beans.xml");
        UserService userService = context.getBean("teacherUserService", TeacherServiceImpl.class);
        userService.hello();
    }

}
